home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 October / 1986-10.d64 / dir extension (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  133 lines

  1. 100 poke 53280,15:poke 53281,15:print"[147]          directory extension"
  2. 110 print"          [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  3. 120 for i=830 to 902:read d:poke i,d:next
  4. 130 dn$="":p$="[175][157][157][170] [146][180][157][157][183]":xx=1
  5. 140 mt$="                   [146]                                        [144]"
  6. 150 dm=144:dim f$(dm),s$(dm),t$(dm),s2$(dm)
  7. 160 for i=0 to dm:f$(i)=chr$(32)+"                  ":next
  8. 170 print"[145]           reading directory  ":open1,8,0,"$":sys 830:close 1
  9. 180 gosub 950
  10. 190 poke 198,0:print"[147]"spc(9)p$"[145][157]1[146]"spc(3)"view directory file"
  11. 200 print""spc(9)p$"[145][157]2[146]"spc(3)"send disk commands"
  12. 210 print""spc(9)p$"[145][157]3[146]"spc(3)"save"
  13. 220 print""spc(9)p$"[145][157]4[146]"spc(3)"view different disk"
  14. 230 print""spc(9)p$"[145][157]5[146]"spc(3)"quit"
  15. 240 print""spc(28)p$"[145][157] [146]":print"[145]"spc(9)"enter your choice [170][191][157]";
  16. 250 poke 204,0:get cg$:if cg$<"1" or cg$>"5" then 250
  17. 260 poke 204,1:poke 207,0:print""cg$:cg=val(cg$)
  18. 270 on cg goto 290,1090,520,1240,1340
  19. 280 rem *** view files ***
  20. 290 c=peek(0)-1:a=1
  21. 300 if a=> c then 330
  22. 310 if a<0 and c/6=int(c/6) then a=c-5:goto 330
  23. 320 if a<0 then dn=int(c/6):a=dn*6+1
  24. 330 print"[147][144][146]   disk title: "f$(0)" ":print"":pq=5
  25. 340 for i=a to a+pq
  26. 350 if f$(i)=chr$(32)+"                  " or f$(i)="" then f$(i)="":pq=pq-1
  27. 360 next
  28. 370 for i= a to a+pq
  29. 380 if i>9 then w$=" [157]":goto 400
  30. 390 w$="  [157]"
  31. 400 print"[157]"i;w$;left$(f$(i),16)":"mt$:print"[145][145]"spc(20);
  32. 410 print""s$(i)"[144]":next
  33. 420 print dn$" f1-menu f3-add f5-fwd f7-back ^-delete":poke 198,0:wait198,1
  34. 430 if peek(197)=54 then 1280
  35. 440 if peek(197)=4 then 190
  36. 450 if peek(197)=5 then 610
  37. 460 if peek(197)=6 and a=c then a=1:goto 300
  38. 470 if peek(197)=6 and a+6>c then a=1:goto 300
  39. 480 if peek(197)=6 and a<c then a=a+6:goto 300
  40. 490 if peek(197)=3 then a=a-6:goto 300
  41. 500 goto 430
  42. 510 rem *** save descriptions ***
  43. 520 print"[145][145]"spc(28)" [157] ":print"[145][145]"spc(9)"  saving "chr$(34)"dir file";
  44. 530 print chr$(34)"...":for r=1 to c:if s$(r)="" then s$(r)=" "
  45. 540 next r
  46. 550 close1:close 15:open 1,8,15,"s0:dir file":close 1:open 15,8,15,"i"
  47. 560 open 1,8,8,"0:dir file,s,w":gosub 1050
  48. 570 print#1,c
  49. 580 for i=1 to c:print#1,left$(f$(i),16):print#1,s$(i):next:close 1
  50. 590 print"[145]                               ":goto 190
  51. 600 rem *** add statements ***
  52. 610 printdn$""spc(9)"f3-add"
  53. 620 print dn$"   enter file[160]#";:poke 198,0:input fi$:fi=val(fi$)
  54. 630 if fi$="0" then printdn$"                  ":goto 420
  55. 640 if fi<a or fi>a+pq then print dn$ spc(17)"                  ":goto 610
  56. 650 print dn$"                          ":if fi<7 then z=fi:goto 680
  57. 660 z=int(fi/6)+1:dd=z*6-fi:z=6-dd
  58. 670 if z=0 then z=6
  59. 680 print"":fori=1 to z:print"":next
  60. 690 f$(fi)=left$(f$(fi),16)
  61. 700 i$=""
  62. 710 print"[145]"spc(19)">"spc(len(i$));:b$="<":cc=len(b$):l=1
  63. 720 print""mid$(b$,l,2);"[157]";:l=-l*(l<cc)+1
  64. 730 get a$:if a$="" or a$=chr$(34) or a$=chr$(44) or a$=chr$(58) then 730
  65. 740 if a$=chr$(59) then 730
  66. 750 if a$=chr$(13) and len(i$)=18 then 910
  67. 760 if len(i$)=18 and a$<>chr$(20) then i$=i$+a$:print a$"[146]    <[157]";:goto 720
  68. 770 if len(i$)=55 then pp=1
  69. 780 if len(i$)=55 and a$<>chr$(20) and a$<>chr$(13) then 730
  70. 790 if a$=chr$(13) and len(i$)=0 then 330
  71. 800 if a$=chr$(13) then 910
  72. 810 if a$=chr$(20) and len(i$)=19 then 880
  73. 820 if a$=chr$(20) and len(i$)>0 then 850
  74. 830 if asc(a$)<32 or asc(a$)>95 then 720
  75. 840 i$=i$+a$:print a$;:goto 720
  76. 850 i$=left$(i$,len(i$)-1)
  77. 860 if len(i$)=54 then print"[146] [157][157]";:goto 720
  78. 870 print" [157][157]";:goto 720
  79. 880 i$=left$(i$,len(i$)-1):print" ":d=19
  80. 890 if pp=1 then print"[145][145][145]"spc(38)"";:goto 720
  81. 900 print"[145][145]"spc(38)"";:goto 720
  82. 910 s$(fi)=i$
  83. 920 if len(s$(fi))<19 then 330
  84. 930 s$(fi)=mid$(s$(fi),1,19)+"[146]    "+mid$(s$(fi),20,37)
  85. 940 s$(fi)=s$(fi)+"[145]":goto 330
  86. 950 open 15,8,15,"i"
  87. 960 open 1,8,8,"0:dir file,s,r":gosub 1050:if en=62 then close 15:return
  88. 970 print"[145]"spc(19)"dir file      "
  89. 980 input#1,c
  90. 990 for i=1to c:input#1,t$(i):input#1,s$(i):s2$(i)=s$(i):next
  91. 1000 close 1:close 15:nf=peek(0)-1
  92. 1010 for a=1to nf:if left$(f$(a),16)=t$(a) then s$(a)=s2$(a):goto 1040
  93. 1020 for b=1 to c:if left$(f$(a),16)=t$(b) then s$(a)=s2$(b):b=c+2
  94. 1030 next b:if b=c+1 then s$(a)=""
  95. 1040 next a:return
  96. 1050 input#15,en,em$:if en=0 then return
  97. 1060 if en=62 and xx=1 then xx=0:return
  98. 1070 print"[147]disk error:";en;em$:print""spc(14)" ":end
  99. 1080 rem *** send disk commands ***
  100. 1090 print"[147] disk commands":print" commands":print"[160][163][163][163][163][163][163][163][163]"
  101. 1100 print" s0:filename"spc(11)"scratch a file
  102. 1110 [153]" r0:newname=oldname    rename a file
  103. 1120 print" v0"spc(20)"validate a disk":print" i0"spc(20)"initialize"
  104. 1130 print" enter command   (return for menu)":z$="":print" >";
  105. 1140 get u$:if u$="" then 1210
  106. 1150 if len(z$)=37 and u$<>chr$(13) and u$<>chr$(20) then 1140
  107. 1160 u=asc(u$):if u=13 then 1220
  108. 1170 if u<>20 then 1200
  109. 1180 if len(z$)<>0 then z$=mid$(z$,1,len(z$)-1):print u$;
  110. 1190 goto 1140
  111. 1200 if u<32 or u>90 then 1140
  112. 1210 print"<[157]";u$;:z$=z$+u$:goto 1140
  113. 1220 if z$="" then 190
  114. 1230 close1:open 1,8,15,z$:close 1:close 15:open 15,8,15,"i":gosub 1050:goto190
  115. 1240 print"[147]       insert new disk into drive"
  116. 1250 print"       press any key to continue":poke 198,0:wait 198,1:get e$
  117. 1260 print"[145]             please wait        ":clr:goto 130
  118. 1270 rem *** delete descriptions ***
  119. 1280 printdn$""spc(31)"^-delete"
  120. 1290 print dn$""spc(10)"                             "
  121. 1300 poke 198,0:fi$="":print dn$"  delete #";:input fi$:fi=val(fi$)
  122. 1310 if fi$="0" then print dn$"              ":goto 420
  123. 1320 if fi<a or fi>a+pq then 1280
  124. 1330 s$(fi)=" ":goto 330
  125. 1340 poke 198,0:sys 198:end
  126. 1350 data 169,255,133,0,165,55,133,71,165,56,133
  127. 1360 data 72,162,1,32,198,255,166,0,232,134,0
  128. 1370 data 216,56,165,71,233,20,133,71,176,5,166
  129. 1380 data 72,202,134,72,32,207,255,164,144,208
  130. 1390 data 22,201,34,208,245,160,0,32,207,255,201
  131. 1400 data 34,240,249,145,71,200,192,19,208,242
  132. 1410 data 240,207,32,204,255,96,0,0,0
  133.